<?php

namespace Home\Controller;

use Common\Controller\HomebaseController;

class AboutController extends HomebaseController
{
    public function index()
    {
        $page = get_one_category(18);
        $page1 = $this->get_page(19);
        $page2 = $this->get_page(20);
        $page3 = $this->get_page(21);
        $page4 = get_one_category(22);
        $seoTitle = "";
        if (!empty($page['name'])) {
            $seoTitle = $page['name'] . ' - ';
        }
        $siteOptions = get_site_options();
        $this->assign('site_seo_title', $seoTitle . $siteOptions['site_name']);
        if (!empty($page['post_keywords'])) {
            $this->assign('site_seo_keywords', $page['post_keywords']);
        }
        if (!empty($page['post_excerpt'])) {
            $this->assign('site_seo_description', $page['post_excerpt']);
        }
        $team = get_where_list('about', array('cid' => 22), 100, '');
        $this->assign('page', $page);
        $this->assign('page1', $page1);
        $this->assign('page2', $page2);
        $this->assign('page3', $page3);
        $this->assign('page4', $page4);
        $this->assign('team', $team);
        $this->display('about');
    }

    function team(){
        $model = M("About");
        $id = I('get.id', 0, 'intval');
        $whereArr = array(
            'status' => 1,
        );
        if ($id > 0) {
            $whereArr['id'] = $id;
        }
        $post = $model->where($whereArr)->find();
        $siteOptions = get_site_options();
        $this->assign('site_seo_title', $post['title'] . ' - ' . $siteOptions['site_name']);
        if (!empty($post['keywords'])) {
            $this->assign('site_seo_keywords', $post['keywords']);
        }
        if (!empty($post['excerpt'])) {
            $this->assign('site_seo_description', $post['description']);
        }
        $this->assign('post',$post);
        $this->display('team');
    }

    function get_page($cid)
    {
        $where = array('cid' => $cid);
        $post = M('about')->where($where)->find();
        return $post;
    }
}